#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Abbas Sheikh (abbas4u@gmail.com)
 Last Updated:   29 Jan, 2012

 Script Function:
	Initializes test suite environment before it begins

Development Environment
	- Windows 7 Professional - 64 Bit
	- Screen Resolution - 1366x768 (Adjust test case constants
	                                as per environment)

#ce ----------------------------------------------------------------------------

#include "tests_common.au3"

; Open log file for logging
OpenLogFile()

; Execute test case
Test_Suite_Init()

; Close log file
CloseLogFile()

Func Test_Suite_Init()
	LogText("Initializing environment before test suite begins ..." & @CRLF)

	; Delete 'MainWindow' registry entry
	Reg_Del_Main_Wnd()

	LogTextWOTime("< ============================================= >" & @CRLF)
EndFunc

;
; Function to delete 'main window' registry entry
;
Func Reg_Del_Main_Wnd()
	; Verify 'Main Window' registry path is correct
	$str = StringFormat("Verifying main window registry path: '%s'\r\n", $REG_MAIN_WINDOW)
	LogText($str)
	SetError(0)
	$ret = RegRead($REG_MAIN_WINDOW, $MAIN_WND_KEY)
	$err = @error
	If ( ($ret <> "") Or ($ret == "" And $err = -1) ) Then
		LogText("Main window registry path verified." & @CRLF)
	Else
		LogText("FATAL ERROR: Main window registry path does not exists. Quiting !!!" & @CRLF)
		LogTextWOTime("< ============================================= >" & @CRLF)
		Exit(1)
	EndIf

	; Deleting MainWindow registry entry
	LogText("Deleting main window registry value: '"&  $MAIN_WND_KEY & "'"& @CRLF)
	If ($err = -1) Then
		LogText("Registry value NOT present." & @CRLF)
		Return
	EndIf
	SetError(0)
	$ret = RegDelete($REG_MAIN_WINDOW, $MAIN_WND_KEY)
	If ($ret = 1) Then
		LogText("Main window registry value deleted successfully." & @CRLF)
	Else
		LogText("FATAL ERROR: Unable to delete 'main window' registry value. It can effect subsequent test cases." & @CRLF)
	EndIf

EndFunc